package cn.south.campus.business.model.vo;

import cn.south.campus.business.model.entity.Wallet;
import cn.south.campus.common.model.vo.BaseVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 *
 * </p>
 *
 * @author chow
 * @since 2025/2/11 13:47
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class WalletVo extends BaseVO {
    /**
     * 用户id
     */
    private Long userId;

    /**
     * 余额
     */
    private String balance;

    /**
     * 冻结金额
     */
    private String frozenAmount;

    public static WalletVo convert(Wallet wallet) {
        if (wallet == null) {
            return null;
        }
        WalletVo walletVo = new WalletVo();
        walletVo.setUserId(wallet.getUserId());
        walletVo.setBalance(wallet.getBalance().toString());
        walletVo.setFrozenAmount(wallet.getFrozenAmount().toString());
        return walletVo;
    }
}
